Inset expressions
Unlike Mathematica, we interpret all expressions passed to Text
, PlotLabel
, etc., normally. Therefore, this approach can conflict with Mathematica's method of displaying equations or Wolfram Language (WL) expressions in labels. For example:
UPD: 29.06.2025 This is no longer an issue. You can pass any expression to Inset
Plot[x, {x, 0, 1}, PlotLabel -> x] ✅
Plot[x, {x, 0, 1}, PlotLabel -> "x"] ✅
Plain Superscript/Subscript and Greek Symbols
There is built-in support for basic TeX-like formatting (though somewhat limited) in all Text or Text-like primitives, including PlotLabel
, AxesLabel
, etc.
Plot[x, {x, 0, 1}, AxesLabel -> {"cm^{-1}", "\\alpha"}]
Some special characters in the Wolfram Language, compatible with the Unicode symbol table, can be entered directly:
Render WL Expressions
Using HoldForm
inside Inset on any expression to prevent it from evaluating:
Plot[x, {x, 0, 10}, Epilog -> {
Inset[
HoldForm[(*FB[*)((1)(*,*)/(*,*)(2))(*]FB*)],
{3, 5}
]
}]
Render LaTeX
Option 1
Using the MaTeX package, you can directly render LaTeX equations into Graphics primitives. Install it from the official repository or use a resource function available online:
ResourceFunction["MaTeXInstall"][]
This package requires LaTeX and Ghostscript to be installed.
<<MaTeX`
Plot[Sin[x]/x, {x, 0, 10}, Epilog -> {
Inset[
MaTeX["\\sum_{k=1}^{\\infty} \\frac{1}{k}", FontSize -> 20],
{3.5, 0.5}
]
}]
If you place it directly on the same canvas by exploding it into primitives using // First
, you may encounter issues with the aspect ratio, as it will be dictated by your plot.